{include file="common/common"}
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="#">系统</a>
                    </li>
                                        <li>
                        <a href="{:url('lst')}">用户组管理</a>
                    </li>
                                        <li class="active">修改用户组</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-header bordered-bottom bordered-blue">
                <span class="widget-caption">修改用户组</span>
            </div>
            <div class="widget-body">
                <div id="horizontal-form">
                    <form class="form-horizontal" role="form" action="{:url('edit')}" method="post">
                        <input type="hidden" name="id" value="{$authGroup.id}">
                        <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">用户组名称</label>
                            <div class="col-sm-6">
                                <input class="form-control" placeholder="" name="title" required="" type="text" value="{$authGroup.title}">
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                        </div>
                        <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right">用户组状态</label>
                            <div class="col-sm-6">
                                <label style="padding-top: 7px">
                                    <input name="status" type="checkbox" {if condition="$authGroup.status" eq 1}checked="checked" {/if} value="1" class="checkbox-slider colored-darkorange"><span class="text"></span>
                                </label>
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="username" class="col-sm-2 control-label no-padding-right"></label>
                            <div class="col-sm-6">
                                <table class="table table-hover">
                                    <thead class="bordered-darkorange">
                                    <tr>
                                        <th>配置权限</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    {volist name="authRuleRes" id="authRule"}
                                    <tr>
                                        <td>
                                            <label>
                                                <?php echo str_repeat('&nbsp;',$authRule['level']*5)?>
                                                <input dataid='id-{$authRule.dataid}'
                                                 <?php if(in_array($authRule['id'],$authGroup['rules'])){echo "checked='checked'";}?>
                                                 type="checkbox"  name="rules[]" value="{$authRule.id}"
                                                class="inverted checkbox-parent {if condition="$authRule['level'] neq 0"}checkbox-child{/if}">
                                                <span class="text">{$authRule.title}</span>
                                            </label>
                                        </td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                            <p class="help-block col-sm-4 red">* 必填</p>
                        </div>
                        <div class="form-group" style="margin-top: 50px">
                            <div class="col-sm-offset-2 col-sm-10">
                                <button type="submit" class="btn btn-default">修改</button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>	
	</div>

	    <!--Basic Scripts-->
    <script src="__static__/style/jquery_002.js"></script>
    <script src="__static__/style/bootstrap.js"></script>
    <script src="__static__/style/jquery.js"></script>
<!--    权限配置-->
<script type="text/javascript">
    $(function(){
        //动态选择框 上下级选中状态变化
        $('input.checkbox-parent').on('change',function (){
            var dataid = $(this).attr("dataid");
            $('input[dataid='+dataid+']').prop('checked',$(this).is(':checked'));
        })
        $('input.checkbox-child').on('change',function (){
            var dataid = $(this).attr("dataid");
            dataid = dataid.substring(0,dataid.lastIndexOf("-"));
            var parent = $('input[dataid='+dataid+']');
            if($(this).is(':checked')){
                parent.prop('checked',true);
                //循环到顶级
                while(dataid.lastIndexOf('-')!=2){
                    console.log(1);
                    dataid = dataid.substring(0,dataid.lastIndexOf("-"));
                    parent = $('input[dataid='+dataid+']');
                    parent.prop('checked',true);
                }
            }else{
                //父级
                if($('input[dataid^='+dataid+'-]:checked').length==0){
                    parent.prop('checked',false);
                    //循环到顶级
                    while(dataid.lastIndexOf("-")!=2){
                        dataid = dataid.substring(0,dataid.lastIndexOf("-"));
                        parent = $('input[dataid='+dataid+']');
                        if($('input[dataid^='+dataid+'-]:checked').length==0){
                            parent.prop('checked',false);
                        }
                    }
                }
            }
        })
    })
</script>
    <!--Beyond Scripts-->
    <script src="__static__/style/beyond.js"></script>




</body></html>